{% extends 'myadmin/base.html' %}
{% block myadmin_user_active %}
    active
{% endblock %}
{% block myadmin %}
    <h3 style="margin-top: 15px">&emsp;&emsp;用户管理</h3>
    <div class="row">

        <div class="col-md-8"></div>
        <form method="get" action="{% url 'myadmin_user' 1 %}" class="col-md-3 ">
            <div class="col-md-4 input-group mb-3 ">
                <input name="keyword" type="text" class="form-control" placeholder="用户名/手机号"
                       aria-label="Recipient's username"
                       aria-describedby="button-addon2">
                <button class="btn btn-outline-secondary" type="submit" id="button-addon2">搜索</button>
            </div>
        </form>
    </div>
    <table class="table">
        <thead>
        <tr>
            <th scope="col">序号</th>
            <th scope="col">用户名</th>
            <th scope="col">用户状态</th>
            <th scope="col">手机号</th>
            <th scope="col">邮箱</th>
            <th scope="col">操作</th>
        </tr>
        </thead>
        <tbody>
        {% for i in user %}
            <tr>
                <th scope="row">{{ forloop.counter }}</th>
                <td>{{ i.name }}</td>

                {% if i.type == 1 %}
                    <td style="color:rgba(21,23,21,0.87);">教师</td>
                {% elif i.type == 3 %}
                    <td style="color:rgba(26,34,196,0.87);">教师</td>
                {% elif i.type == 6 %}
                    <td style="color:rgba(16,124,34,0.87);">管理员</td>
                {% elif i.type == 9 %}
                    <td style="color:rgba(168,44,16,0.87);">禁用</td>
                {% endif %}

                <td>{{ i.phone }}</td>
                <td>{{ i.email }}</td>
                <td><a href="/myadmin/user_edit/{{ i.id }}"
                       class="btn btn-primary glyphicon glyphicon-pencil btn-sm">编辑</a>
                    <a onclick="if(confirm('确定删除吗？')==false)return false;location.href=('{% url 'myadmin_user_del' i.id %}')"
                       class="btn btn-danger glyphicon glyphicon-remove btn-sm">删除
                    </a></td>
            </tr>
        {% endfor %}


        </tbody>
    </table>
    <nav aria-label="Page navigation example">
        <ul class="pagination justify-content-end" style="margin-right: 40px">
            <li class="page-item">
                <a class="page-link" href="/myadmin/user/{{ pIndex|add:-1 }}" aria-label="Previous">
                    <span aria-hidden="true">&laquo;</span>
                </a>
            </li>
            {% for i in plist %}
                <li {% if i == pIndex %} class="page-item active" {% else %} class=" page-item"{% endif %}  ><a
                        class="page-link" href="/myadmin/stu/{{ i }}">{{ i }}</a></li>
            {% endfor %}
            <li class="page-item">
                <a class="page-link" href="/myadmin/user/{{ pIndex|add:+1 }}" aria-label="Next">
                    <span aria-hidden="true">&raquo;</span>
                </a>
            </li>
        </ul>
    </nav>




{% endblock %}

